pub fn read()->usize {
    let mut rt = 0;
    unsafe {
        asm!("
            csrr {rt}, sscratch
        ", rt=out(reg)rt);
    }
    rt
}

pub fn set(v : usize) {
    unsafe {
        asm!("
            csrs sscratch, {v}
        ", v=in(reg)v);
    }
}

pub fn clear(v : usize) {
    unsafe {
        asm!("
            csrc sscratch, {v}
        ", v=in(reg)v);
    }
}

pub fn write(v : usize) {
    unsafe {
        asm!("
            csrw sscratch, {v}
        ", v=in(reg)v);
    }
}
use core::arch::asm;
